﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace MetroGA.Core.Hits
{
	internal class TimingHit : Hit
	{
		public string Category { get; set; }
		public TimeSpan Interval { get; set; }
		public string Name { get; set; }
		public string Label { get; set; }

		public override IEnumerable<KeyValuePair<string, string>> ToKeyValuePairs()
		{
			var dic = new Dictionary<string, string>
				{
					{"t", "timing"},
					{"utc", Category},
					{"utv", Name},
					{"utt", ((int) Interval.TotalMilliseconds).ToString()},
				};

			if (!String.IsNullOrWhiteSpace(Label))
				dic.Add("utl", Label);

			return dic.Concat(base.ToKeyValuePairs());
		}
	}
}